Adaptive Distribution Method For Hash Operation

ABSTRACT

A method, apparatus, and system for join operations of a plurality of relations that are distributed over a plurality of storage locations over a network of computing components.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.16/039,710 entitled “Adaptive Distribution Method for Hash Operations,”filed Jul. 19, 2018, which is a continuation of U.S. application Ser.No. 14/626,836, entitled “Adaptive Distribution Method for HashOperations,” filed Feb. 19, 2015, the disclosures of which areincorporated herein by reference in its entirety.

This application also claims the benefit of U.S. Provisional ApplicationSer. No. 61/941,986, entitled “Apparatus and method for enterprise datawarehouse data processing on cloud infrastructure,” filed Feb. 19, 2014,the disclosure of which is incorporated herein by reference in itsentirety.

TECHNICAL FIELD

The present disclosure relates to resource management systems andmethods that manage data storage and computing resources.

BACKGROUND

Many existing data storage and retrieval systems are available today.For example, in a shared-disk system, all data is stored on a sharedstorage device that is accessible from all of the processing nodes in adata cluster. In this type of system, all data changes are written tothe shared storage device to ensure that all processing nodes in thedata cluster access a consistent version of the data. One of the maindisadvantages of the shared link system is that as the number ofprocessing nodes increases in a shared-disk system, the shared storagedevice (and the communication links between the processing nodes and theshared storage device) becomes a bottleneck that slows data read anddata write operations. This bottleneck is further aggravated with theaddition of more processing nodes. Thus, existing shared-disk systemshave limited scalability due to this bottleneck problem.

Another existing data storage and retrieval system is referred to as a“shared-nothing architecture.” In this architecture, data is distributedacross multiple processing nodes such that each node stores a subset ofthe data in the entire database. When a new processing node is added orremoved, the shared-nothing architecture must rearrange data across themultiple processing nodes. This rearrangement of data can betime-consuming and disruptive to data read and write operations executedduring the data rearrangement. And, the affinity of data to a particularnode can create “hot spots” on the data cluster for popular data.Further, since each processing node performs also the storage function,this architecture requires at least one processing node to store data.Thus, a disadvantage of the shared-nothing architecture is that it failsto store data if all processing nodes are removed. Additionally,management of data in a shared-nothing architecture is complex due tothe distribution of data across many different processing nodes.

The systems and methods described herein provide an improved approach todata storage and data retrieval that alleviates the above-identifiedlimitations of existing systems.

BRIEF DESCRIPTION OF THE DRAWINGS

Non-limiting and non-exhaustive embodiments of the present disclosureare described with reference to the following figures, wherein likereference numerals refer to like parts throughout the various figuresunless otherwise specified.

FIG. 1 illustrates a schematic of processes for joining a plurality ofrelations in accordance with the methods and systems described herein.

FIG. 2 illustrates a block diagram depicting an example embodiment ofthe systems and methods described herein.

FIG. 3 illustrates a block diagram depicting an embodiment of a resourcemanager in accordance with the methods and systems described herein.

FIG. 4 illustrates a block diagram depicting an embodiment of anexecution platform in accordance with the methods and systems describedherein.

FIG. 5 illustrates a method for the join of a plurality of relations inaccordance with the methods and systems described herein.

FIG. 6 illustrates a block diagram depicting an example operatingenvironment having multiple distributed virtual warehouses and virtualwarehouse groups in accordance with the methods and systems describedherein.

FIG. 7 illustrates a flow diagram depicting an embodiment of a methodfor a join of a plurality of relations in accordance with the methodsand systems described herein.

FIG. 8 illustrates a flow diagram depicting an embodiment of a methodfor a join of a plurality of relations in accordance with the methodsand systems described herein.

FIG. 9 illustrates a flow diagram depicting an embodiment of a methodfor a join of a plurality of relations in accordance with the methodsand systems described herein.

FIG. 10 illustrates a flow diagram depicting an embodiment of a methodfor a join of a plurality of relations in accordance with the methodsand systems described herein.

FIG. 11 illustrates a block diagram depicting an example computingdevice in accordance with the methods and systems described herein.

DETAILED DESCRIPTION

Disclosed herein are improved methods and systems for joining relationsdistributed over a computer network and associated via communicationlinks and processing nodes. These methods and systems may reduce and/oreliminate the disadvantage of failing to store data if processing nodesare removed in the shared-nothing architecture, and the disadvantage oflimited scalability in the shared-link system. Furthermore, the methodsand systems described herein allow data to be stored and accessed as aservice that may be separated from computing (or processing) resourceconsiderations. The described methods and systems are useful with anytype of data, and as discussed in greater detail below, these methodsenable virtual warehouses to access any data to which it has accesspermissions, even at the same time as other virtual warehouses areaccessing the same data. These disclosed methods and systems supportrunning queries without any actual data stored in the local cache.

Additionally, the methods and systems described herein are capable oftransparent dynamic data movement, which moves data from a remotestorage device to a local cache, as needed, in a manner that istransparent to the user of the system. Further, this architecturesupports data sharing without prior data movement since any virtualwarehouse can access any data due to the decoupling of the data storageservice from the computing service.

An exemplary method may begin by receiving a relational join query for ajoin operation comprising a predicate and a plurality of relationswherein the desired join uses an equivalence operation. Additionally,communication links between a build operation and a probe operation thatmay be substantially inactive are placed in an adaptive state, andcommunication links between a first relation and the probe operationthat may be substantially inactive and are placed in an adaptive state.The method may further comprise placing communication links between asecond relation in a partition state such that any tuples of the secondrelation are forwarded to the build operation, and repeating the buildoperation until the second relation is fully consumed and forwarded tothe build operation such that an actual size of the second relation isknown after being fully consumed. Additionally, the method may determinewhether to join the relations via a broadcasting join or a re-portioningjoin based primarily on the actual size of the second relation, anestimated size of the first relation, and a cost metric.

In the following description, reference is made to the accompanyingdrawings that form a part thereof, and in which is shown by way ofillustration specific exemplary embodiments in which the disclosure maybe practiced. These embodiments are described in sufficient detail toenable those skilled in the art to practice the concepts disclosedherein, and it is to be understood that modifications to the variousdisclosed embodiments may be made, and other embodiments may beutilized, without departing from the scope of the present disclosure.The following detailed description is, therefore, not to be taken in alimiting sense.

Reference throughout this specification to “one embodiment,” “anembodiment,” “one example” or “an example” means that a particularfeature, structure or characteristic described in connection with theembodiment or example is included in at least one embodiment of thepresent disclosure. Thus, appearances of the phrases “in oneembodiment,” “in an embodiment,” “one example” or “an example” invarious places throughout this specification are not necessarily allreferring to the same embodiment or example. Furthermore, the particularfeatures, structures, databases or characteristics may be combined inany suitable combinations and/or sub-combinations in one or moreembodiments or examples. In addition, it should be appreciated that thefigures provided herewith are for explanation purposes to personsordinarily skilled in the art and that the drawings are not necessarilydrawn to scale.

Embodiments in accordance with the present disclosure may be embodied asan apparatus, method or computer program product. Accordingly, thepresent disclosure may take the form of an entirely hardware-comprisedembodiment, an entirely software-comprised embodiment (includingfirmware, resident software, micro-code, etc.) or an embodimentcombining software and hardware aspects that may all generally bereferred to herein as a “circuit,” “module” or “system.” Furthermore,embodiments of the present disclosure may take the form of a computerprogram product embodied in any tangible medium of expression havingcomputer-usable program code embodied in the medium.

Any combination of one or more computer-usable or computer-readablemedia may be utilized. For example, a computer-readable medium mayinclude one or more of a portable computer diskette, a hard disk, arandom access memory (RAM) device, a read-only memory (ROM) device, anerasable programmable read-only memory (EPROM or Flash memory) device, aportable compact disc read-only memory (CDROM), an optical storagedevice, and a magnetic storage device. Computer program code forcarrying out operations of the present disclosure may be written in anycombination of one or more programming languages. Such code may becompiled from source code to computer-readable assembly language ormachine code suitable for the device or computer on which the code willbe executed.

Embodiments may also be implemented in cloud computing environments. Inthis description and the following claims, “cloud computing” may bedefined as a model for enabling ubiquitous, convenient, on-demandnetwork access to a shared pool of configurable computing resources(e.g., networks, servers, storage, applications, and services) that canbe rapidly provisioned via virtualization and released with minimalmanagement effort or service provider interaction and then scaledaccordingly. A cloud model can be composed of various characteristics(e.g., on-demand self-service, broad network access, resource pooling,rapid elasticity, and measured service), service models (e.g., Softwareas a Service (“SaaS”), Platform as a Service (“PaaS”), andInfrastructure as a Service (“IaaS”)), and deployment models (e.g.,private cloud, community cloud, public cloud, and hybrid cloud).

The flow diagrams and block diagrams in the attached figures illustratethe architecture, functionality, and operation of possibleimplementations of systems, methods, and computer program productsaccording to various embodiments of the present disclosure. In thisregard, each block in the flow diagrams or block diagrams may representa module, segment, or portion of code, which comprises one or moreexecutable instructions for implementing the specified logicalfunction(s). It will also be noted that each block of the block diagramsand/or flow diagrams, and combinations of blocks in the block diagramsand/or flow diagrams, may be implemented by special purposehardware-based systems that perform the specified functions or acts, orcombinations of special purpose hardware and computer instructions.These computer program instructions may also be stored in acomputer-readable medium that can direct a computer or otherprogrammable data processing apparatus to function in a particularmanner, such that the instructions stored in the computer-readablemedium produce an article of manufacture including instruction meanswhich implement the function/act specified in the flow diagram and/orblock diagram block or blocks.

The systems and methods described herein provide a flexible and scalablesolution to the problem of computing a relational join in a distributedsystem in a manner that minimizes the amount of data to be copied, whenthe predicate θ contains at least one equality relation (making this aso-called equijoin), and when the size of input relations R and S is notknown in advance. In some embodiments, the described systems and methodsmay leverage a cloud infrastructure that supports cloud-based storageresources, computing resources, and the like that will be described ingreater detail below. Example cloud-based storage resources offersignificant storage capacity available on-demand at a low cost. Further,these cloud-based storage resources may be fault-tolerant and highlyscalable, which can be costly to achieve in private data storagesystems.

In the described systems and methods, a data storage system may utilizesan SQL (Structured Query Language)-based relational database. However,these systems and methods are applicable to any type of database usingany data storage architecture and using any language to store andretrieve data within the database. The systems and methods describedherein further provide a multi-tenant system that supports isolation ofdistributed computing resources and data between differentcustomers/clients and between different users within the samecustomer/client. In such systems in order to make the data useful, itmay be evaluated through join processes which associate tuples for therelations that have been distributed over the system.

FIG. 1 illustrates a series of process for performing an equijoin of aplurality of relations in a distributed implementation. Assume we arecomputing an equijoin of two relations R and S. The figure shows threeseparate execution plans of processes that make up an equijoin.Relational operators and input expressions are represented as ovals, andcommunication links are represented as arrows, and the direction of thearrow indicates the direction of data flow. While the plan shows eachoperator as a single oval that may be part of a distributed executionplan. For each operator there are n instances, one instance for eachprocess or machine in the system. These instances run in parallel andexchange data chiefly through communication links. In furtherance of theexample implementation, let the input relations R and S be partitioned(i.e. fragmented) among the n processors or machines in the system.There are two basic ways to compute a distributed equijoin of R and S:broadcast one of the relations, or re-partition both input relations.

As used herein a join is a binary operator, taking at least tworelations and a binary predicate as inputs from a user via a computer,and producing a single relation which contains the set of allcombinations of tuples in the two relations which satisfy the predicate.To produce the correct result, any implementation of join associates allpairs of tuples which may satisfy the predicate. In a distributedimplementation of a join, the system may copy tuples of the originalrelations over the network such that every corresponding pair of tuplesis made available at one process, or on one computer within the system,which can then evaluate the predicate and produce a desired result ofall tuples that satisfy the predicate.

As can be seen in the figure, relations R and S, and a binary predicate(θ) may be received as inputs and processed into producing a singlerelation R

_(θ)S which contains the set of all combinations of tuples in R and Swhich satisfy the predicate θ. It should be noted that to produce thecorrect result, any implementation of join must bring together all pairsof tuples which may satisfy the predicate θ. In a distributedimplementation of join, the system may therefore copy tuples of R and Sover the networked system such that every corresponding pair of tuplesbecomes available to one process or machine within the system, which canthen evaluate the predicate against the relations and discover allresultant tuples that satisfy the predicate.

As illustrated in the example, the input relations R and S may be stored(i.e. fragmented) among a plurality of processors or machines in asystem. In an implementation a distributed equijoin of R and S may becomputed by either broadcasting one of the relations over the network,or by re-partitioning both input relations into a single location withinthe system.

In a broadcasting join, one of the input relations (typically thesmaller relation) is broadcast to n-number of processors or machines,while the other input relation (typically the larger relation) remainsin situ. In the present implementation, |X| may represent the size ofrelation X in number of bytes, and relation R may be the relation thatis broadcasted, therefore resulting in an expected asymptotic networkcost of broadcast join that is represented by the expression O(|R|*n).

In contrast, a re-partitioning join partitions the input relationsaccording to one or more of the join keys (columns on which there existsan equality join predicate as part of the query). In certainembodiments, both hash partitioning or range partitioning may beapplicable for this purpose. Each process or machine may be assigned oneof the partitions, and the data of both input relations may then copiedover the network accordingly. The expected asymptotic network cost ofthis re-partitioning is O(|R|+|S|).

Additionally, one skilled in the art will recognize that deciding onwhich technique to apply, broadcast or re-partition, in order tominimize the network cost may be dependent on the size of the smallerinput relation, say R. For example, if |R|*n<|R|+|S|, then a broadcastjoin may be preferred, otherwise a re-partitioning join is to bepreferred.

It should be noted that network cost is just one metric to use forpurposes of making a decision as to which join method is employed. In animplementation, a system may also take the memory cost and computationalcost of the per-partition joins into account. It will be recognized byone skilled in the art that a broadcasting join replicates the broadcastrelation at every process and it generally has higher memory andcomputational cost than a re-partitioning join.

The equijoin implementation may be split into two operators: buildoperators 125 and probe operators 135. The build operator 125 may beresponsible for deciding whether to perform a broadcasting join or are-partitioning join, while the probe operator 135 performs the actual,local join. A local join implementation may be orthogonal to thisinvention such that any local join implementation is possible such asfor example: hash join, sort-merge join, and nested-loops. As usedherein, a build operator typically builds a hash table while a probeoperator reads the inner stream and probes the hash table to findmatching rows in order to complete a hash join process. Additionally, asused herein an equijoin is an inner join statement or operation thatuses an equivalence operation (i.e., colA=colB) to match rows fromdifferent tables, wherein an inner join statement requires each recordin the joined relations to have matching records.

The upper plan 105 shows an execution plan at the beginning of queryexecution. The communication link 140 between the build operator and theprobe operator, as well as communication link 141 between S and theprobe operator, are initially inactive and in the “adaptive” state. Thecommunication link 142 between R and the build operator is in the“partition” state, which means that any tuples produced by R areforwarded to one of the instances of the build operator, as determinedby a partitioning function, such as a hash function over one or more ofthe columns of R which appear in equality predicates of the joinpredicate.

Initially, only the “left” side of the tree 105 in the figure may beexecuted; that is, the input relation R (which can be a base relation oritself the output of some complex sub-expression, for example anotherjoin) is fully consumed and forwarded to the build operator 125. Oneskilled in the art will understand that the build operator 125 maybuffer all its input, either in main memory or on external storage(disk).

Once the relation R has been fully consumed by the build operator 125,the actual size of the relation R is known because the system knows theamount of data that has just been processed in the build operation. Thesystem may then determine whether to perform a broadcasting orre-partitioning join based on the known-actual size of relation R, anestimated size of relation S, and a predetermined cost metric asdiscussed above.

It can be seen in FIG. 1 that the left lower execution plan 109 showsthe plan for the broadcasting join, and the right lower execution plan107 shows the plan for the re-partitioning join.

As illustrated, if the build operator decides to perform a broadcastingjoin, the link between the build operator and the probe operator isconverted into a “bcast” (broadcast) link 143, and the link betweenrelation S and the probe operator is converted to into a “sync”(synchronous) link. Then, it sends relation R through the broadcast link143, which means the local partition of relation R of each instance ofthe build operator 126 is broadcasted to every instance of the probeoperator 136. As used herein the terms “synchronous link” denote alocal, one-to-one link between two operator instances, and does notcross machine or thread boundaries and can thus be implemented withrelative efficiency. For example, a synchronous link may be a simplefunction call from the upstream operator's code into the downstreamoperator's code. In this implementation, a synchronous link does notperform a network transfer, and the local partition of relation S ofeach process or machine is directly forwarded to its local instance ofthe probe operator 136.

Conversely, if the build operator decides to perform a re-partitioningjoin, the communication link between the build operator 127 and theprobe operator 137 is converted into a “sync” link 153, and converts thelink between S and the probe operator into a partition or “part” link154. Additionally, the partitioning function on relation S may be“compatible” with the partitioning function previously applied torelation R (in the communication link 155 between R and the buildoperator), such that each pair of tuples which may satisfy the predicateends up in the same partition and thus at the same instance of the probeoperator 156.

An important optimization to the re-partitioning example above, is thatthe build operator 165 instances need not read back their buffered inputin order to send it over the “sync” link to their individuallycorresponding probe operator 156 instances. Relation R has already beenre-partitioned by the communication link 155 between R and the buildoperator in a manner that is compatible with the “part.” link 154 thatis between S and the probe operator. Thus, the partition of relation Rbelonging to a corresponding build operator 165 instance can be passedwhole without further processing. In some implementation the partitionof relation R may be passed as a single pointer to a block of memory ora file on disk.

In contrast to existing products which rely on the query optimizer tomake the decision on whether to broadcast or re-partition ahead of time,the present method describes a way to defer the decision on whether tobroadcast or re-partition to query execution time; that is, to the pointwhen the size of one of the input relations is known with certainty, andthe size of the other input relation can often be estimated with greateraccuracy. Thus, the present implementation provides a way to bothdetermine the cost of a broadcasting join with a high level ofcertainty, and whether to make the decision to broadcast or re-partitionrelations with greater confidence.

These methods and processes may be immediately applicable to allimplementations of distributed equijoin as found in virtually alldistributed relational database systems, as well as implementations ofequijoin in dataflow systems such as Hadoop/MapReduce. The aboveprocesses may be performed in a system having resource managers andmultiple users.

As shown in FIG. 2, a resource manager 202 is coupled to multiple users204, 206, and 208. In particular implementations, resource manager 202can support any number of users desiring access to data processingplatform 200. Users 204-208 may include, for example, end usersproviding data storage and retrieval requests, system administratorsmanaging the systems and methods described herein, and othercomponents/devices that interact with resource manager 202. Resourcemanager 202 provides various services and functions that support theoperation of all systems and components within data processing platform200. Resource manager 202 is also coupled to metadata 210, which isassociated with the entirety of data stored throughout data processingplatform 200. In some embodiments, metadata 210 includes a summary ofdata stored in remote data storage systems as well as data availablefrom a local cache. Additionally, metadata 210 may include informationregarding how data is organized in the remote data storage systems andthe local caches. Metadata 210 allows systems and services to determinewhether a piece of data needs to be processed without loading oraccessing the actual data from a storage device.

Resource manager 202 is further coupled to an execution platform 212,which provides multiple computing resources that execute various datastorage and data retrieval tasks, as discussed in greater detail below.Execution platform 212 is coupled to multiple data storage devices 216,218, and 220 that are part of a storage platform 214. Although threedata storage devices 216, 218, and 220 are shown in FIG. 2, executionplatform 212 is capable of communicating with any number of data storagedevices. In some embodiments, data storage devices 216, 218, and 220 arecloud-based storage devices located in one or more geographic locations.For example, data storage devices 216, 218, and 220 may be part of apublic cloud infrastructure or a private cloud infrastructure. Datastorage devices 216, 218, and 220 may be hard disk drives (HDDs), solidstate drives (SSDs), storage clusters, Amazon S3™ storage systems or anyother data storage technology. Additionally, storage platform 214 mayinclude distributed file systems (such as Hadoop Distributed FileSystems (HDFS)), object storage systems, and the like.

In particular embodiments, the communication links between resourcemanager 202 and users 204-208, metadata 210, and execution platform 212are implemented via one or more data communication networks. Similarly,the communication links between execution platform 212 and data storagedevices 216-220 in storage platform 214 are implemented via one or moredata communication networks. These data communication networks mayutilize any communication protocol and any type of communication medium.In some embodiments, the data communication networks are a combinationof two or more data communication networks (or sub-networks) coupled toone another. In alternate embodiments, these communication links areimplemented using any type of communication medium and any communicationprotocol.

As shown in FIG. 2, data storage devices 216, 218, and 220 are decoupledfrom the computing resources associated with execution platform 212.This architecture supports dynamic changes to data processing platform200 based on the changing data storage/retrieval needs as well as thechanging needs of the users and systems accessing data processingplatform 200. The support of dynamic changes allows data processingplatform 200 to scale quickly in response to changing demands on thesystems and components within data processing platform 200. Thedecoupling of the computing resources from the data storage devicessupports the storage of large amounts of data without requiring acorresponding large amount of computing resources. Similarly, thisdecoupling of resources supports a significant increase in the computingresources utilized at a particular time without requiring acorresponding increase in the available data storage resources.

Resource manager 202, metadata 210, execution platform 212, and storageplatform 214 are shown in FIG. 2 as individual components. However, eachof resource manager 202, metadata 210, execution platform 212, andstorage platform 214 may be implemented as a distributed system (e.g.,distributed across multiple systems/platforms at multiple geographiclocations). Additionally, each of resource manager 102, metadata 110,execution platform 212, and storage platform 214 can be scaled up ordown (independently of one another) depending on changes to the requestsreceived from users 204-208 and the changing needs of data processingplatform 200. Thus, in the described embodiments, data processingplatform 100 is dynamic and supports regular changes to meet the currentdata processing needs.

FIG. 3 illustrates a block diagram depicting an embodiment of resourcemanager 202. As shown in FIG. 3, resource manager 202 includes an accessmanager 302 and a key manager 304 coupled to a data storage device 306.Access manager 302 handles authentication and authorization tasks forthe systems described herein. Key manager 304 manages storage andauthentication of keys used during authentication and authorizationtasks. A request processing service 308 manages received data storagerequests and data retrieval requests. A management console service 310supports access to various systems and processes by administrators andother system managers.

Resource manager 202 also includes an SQL compiler 312, an SQL optimizer314 and an SQL executor 310. SQL compiler 312 parses SQL queries andgenerates the execution code for the queries. SQL optimizer 314determines the best method to execute queries based on the data thatneeds to be processed. SQL executor 316 executes the query code forqueries received by resource manager 302. A query scheduler andcoordinator 318 sends received queries to the appropriate services orsystems for compilation, optimization, and dispatch to executionplatform 212. A virtual warehouse manager 320 manages the operation ofmultiple virtual warehouses implemented in execution platform 212.

Additionally, resource manager 202 includes a configuration and metadatamanager 322, which manages the information related to the data stored inthe remote data storage devices and in the local caches. A monitor andworkload analyzer 324 oversees the processes performed by resourcemanager 102 and manages the distribution of tasks (e.g., workload)across the virtual warehouses and execution nodes in execution platform212. Configuration and metadata manager 322 and monitor and workloadanalyzer 324 are coupled to a data storage device 326.

Resource manager 202 also includes a transaction management and accesscontrol module 328, which manages the various tasks and other activitiesassociated with the processing of data storage requests and data accessrequests. For example, transaction management and access control module328 provides consistent and synchronized access to data by multipleusers or systems. Since multiple users/systems may access the same datasimultaneously, changes to the data must be synchronized to ensure thateach user/system is working with the current version of the data.Transaction management and access control module 328 provides control ofvarious data processing activities at a single, centralized location inresource manager 202.

FIG. 4 is a block diagram depicting an embodiment of an executionplatform 212 of FIG. 2 that is an example of a distributed system. Asshown in FIG. 4, execution platform 212 includes multiple virtualwarehouses 402, 404, and 406. Each virtual warehouse includes multipleexecution nodes that each include a cache and a processor. Although eachvirtual warehouse 402-406 shown in FIG. 4 includes three executionnodes, a particular virtual warehouse may include any number ofexecution nodes. Further, the number of execution nodes in a virtualwarehouse is dynamic, such that new execution nodes are created whenadditional demand is present, and existing execution nodes are deletedwhen they are no longer necessary.

Each virtual warehouse 402-406 is capable of accessing any of the datastorage devices 216-220 shown in FIG. 2. Thus, virtual warehouses402-406 are not necessarily assigned to a specific data storage device216-220 and, instead, can access data from any of the data storagedevices 216-220. Similarly, each of the execution nodes shown in FIG. 4can access data from any of the data storage devices 216-220. In someembodiments, a particular virtual warehouse or a particular executionnode may be temporarily assigned to a specific data storage device, butthe virtual warehouse or execution node may later access data from anyother data storage device.

In the example of FIG. 4, virtual warehouse 402 includes three executionnodes 408, 410, and 412. Execution node 408 includes a cache 414 and aprocessor 416. Execution node 410 includes a cache 418 and a processor420. Execution node 412 includes a cache 422 and a processor 424. Eachexecution node 408-412 is associated with processing one or more datastorage and/or data retrieval tasks. For example, a particular virtualwarehouse may handle data storage and data retrieval tasks associatedwith a particular user or customer. In other implementations, aparticular virtual warehouse may handle data storage and data retrievaltasks associated with a particular data storage system or a particularcategory of data.

Similar to virtual warehouse 402 discussed above, virtual warehouse 404includes three execution nodes 426, 428, and 430. Execution node 426includes a cache 432 and a processor 434. Execution node 428 includes acache 436 and a processor 438. Execution node 430 includes a cache 440and a processor 442. Additionally, virtual warehouse 406 includes threeexecution nodes 444, 446, and 448. Execution node 444 includes a cache450 and a processor 452. Execution node 446 includes a cache 454 and aprocessor 456. Execution node 448 includes a cache 458 and a processor460.

Although the execution nodes shown in FIG. 4 each include one cache andone processor, alternate embodiments may include execution nodescontaining any number of processors and any number of caches.Additionally, the caches may vary in size among the different executionnodes. The caches shown in FIG. 4 store, in the local execution node,data that was retrieved from one or more data storage devices in storageplatform 214 (FIG. 2). Thus, the caches reduce or eliminate thebottleneck problems occurring in platforms that consistently retrievedata from remote storage systems. Instead of repeatedly accessing datafrom the remote storage devices, the systems and methods describedherein access data from the caches in the execution nodes which issignificantly faster and avoids the bottleneck problem discussed above.In some embodiments, the caches are implemented using high-speed memorydevices that provide fast access to the cached data. Each cache canstore data from any of the storage devices in storage platform 214.

Further, the cache resources and computing resources may vary betweendifferent execution nodes. For example, one execution node may containsignificant computing resources and minimal cache resources, making theexecution node useful for tasks that require significant computingresources. Another execution node may contain significant cacheresources and minimal computing resources, making this execution nodeuseful for tasks that require caching of large amounts of data. In someembodiments, the cache resources and computing resources associated witha particular execution node are determined when the execution node iscreated, based on the expected tasks to be performed by the executionnode.

Additionally, the cache resources and computing resources associatedwith a particular execution node may change over time based on changingtasks performed by the execution node. For example, a particularexecution node may be assigned more processing resources if the tasksperformed by the execution node become more processor intensive.Similarly, an execution node may be assigned more cache resources if thetasks performed by the execution node require a larger cache capacity.

Although virtual warehouses 402-406 are associated with the sameexecution platform 212, the virtual warehouses may be implemented usingmultiple computing systems at multiple geographic locations. Forexample, virtual warehouse 402 can be implemented by a computing systemat a first geographic location, while virtual warehouses 404 and 406 areimplemented by another computing system at a second geographic location.In some embodiments, these different computing systems are cloud-basedcomputing systems maintained by one or more different entities.

Additionally, each virtual warehouse is shown in FIG. 4 as havingmultiple execution nodes. The multiple execution nodes associated witheach virtual warehouse may be implemented using multiple computingsystems at multiple geographic locations. For example, a particularinstance of virtual warehouse 402 implements execution nodes 408 and 410on one computing platform at a particular geographic location, andimplements execution node 412 at a different computing platform atanother geographic location. Selecting particular computing systems toimplement an execution node may depend on various factors, such as thelevel of resources needed for a particular execution node (e.g.,processing resource requirements and cache requirements), the resourcesavailable at particular computing systems, communication capabilities ofnetworks within a geographic location or between geographic locations,and which computing systems are already implementing other executionnodes in the virtual warehouse. Execution platform 212 is also faulttolerant. For example, if one virtual warehouse fails, that virtualwarehouse is quickly replaced with a different virtual warehouse at adifferent geographic location.

A particular execution platform 212 may include any number of virtualwarehouses 402-406. Additionally, the number of virtual warehouses in aparticular execution platform is dynamic, such that new virtualwarehouses are created when additional processing and/or cachingresources are needed. Similarly, existing virtual warehouses may bedeleted when the resources associated with the virtual warehouse are nolonger necessary.

FIG. 5 illustrates an implementation of a method for performing aequijoin process over a distributed system. As can be seen in thefigure, method 500 may begin with receiving a relational join querycomprising a predicate and a plurality of relations at 510. As in theexample of FIG. 1, the first and second relations may be R and S. Asillustrated in FIG. 1, the input relations R and S may be stored among aplurality of processors or machines in a system. In an implementation adistributed equijoin of R and S may be computed by either broadcastingone of the relations over the network, or by re-partitioning both inputrelations into a single location within the system.

The method may then call for separating the equijoin operation into abuild operation and a probe operation 520, and will continue bygenerating a build operator for the build operation at 530 and a probeoperator for the probe operations at 540. The build operator may beresponsible for deciding whether to perform broadcasting orre-partitioning join, and the probe operator may perform the actual,local join. In an implementation the local join implementation may beorthogonal to this invention such that any local join implementation ispossible such as for example: hash join, sort-merge join, andnested-loops.

Once the probe operator and build operator has been created, the method500 can address the communication links to the relations by placingcommunication links between a first relation and the probe operator inan adaptive state at 550. In an implementation, the adaptive state maybe a waiting state that will later be modified into an active stateduring execution of the method. For example, the communication linkbetween the build operator and the probe operator, as well ascommunication link between S and the probe operator, are initiallyinactive and in the “adaptive” state.

The method may then continue by placing the communication links to asecond relation, in a partition state at 560, wherein the partitionstate facilitates the partition move of the second relation. Forexample, the communication link between R and the build operator may bein the “part.” state, which means that any tuples produced by R areforwarded to one of the instances of the build operator, as determinedby a partitioning function, such as a hash function over one or more ofthe columns of R which appear in equality predicates of the joinpredicate.

Once the communication links are place in the proper state, at 570 themethod causes computing components within the system to repeat the buildoperation until the second relation is fully consumed and forwarded tothe build operators. As mentioned above, the build operators may bestored in local cache so as to reduce traffic over the distributedsystem. After the relation has been consumed by the build operator theactual size of the relation is known. Having actual knowledge of therelation allows the method to determine the most efficient type of jointo use.

Accordingly, at 580 the method determines whether to join the relationsvia the broadcasting join or the re-portioning join based on the actualsize of the second relation, an estimated size of the first relation,and a cost metric. Additionally, one skilled in the art will recognize,that deciding on which technique to apply, broadcast or re-partition, inorder to minimize the network cost may be dependent on the size of thesmaller input relation, say R. For example, if |R|*n<|R|+|S|, then abroadcast join may be preferred, otherwise a re-partitioning join is tobe preferred. It should be noted that network cost is just one metric touse for purposes of making a decision as to which join method isemployed. In an implementation, a system may also take the memory costand computational cost of the per-partition joins into account. It willbe recognized by one skilled in the art that a broadcasting joinreplicates the broadcast relation at every process and it generally hashigher memory and computational cost than a re-partitioning join.

At 590, the method causes the computing components of the system toperform the equijoin of the first and second relations, therebyreturning all of the tuples that satisfy the predicate. As used herein ajoin is a binary operator, taking at least two relations and a binarypredicate as inputs from a user via a computer, and producing a singlerelation which contains the set of all combinations of tuples in the tworelations which satisfy the predicate. To produce the correct result,any implementation of join associates all pairs of tuples which maysatisfy the predicate. In a distributed implementation of a join, thesystem may copy tuples of the original relations over the network suchthat every corresponding pair of tuples is made available at oneprocess, or on one computer within the system, which can then evaluatethe predicate and produce a desired result of all tuples that satisfythe predicate.

FIG. 6 is a block diagram depicting another example operatingenvironment 600 having multiple distributed virtual warehouses andvirtual warehouse groups. Environment 600 includes resource manager 202that communicates with virtual warehouse groups 604 and 606 through adata communication network 602. Warehouse group 604 includes two virtualwarehouses 608 and 610, and warehouse group 606 includes another twovirtual warehouses 614 and 616. Resource manager 202 also communicateswith virtual warehouse 612 (which is not part of a virtual warehousegroup) through data communication network 602.

Virtual warehouse groups 604 and 606 as well as virtual warehouse 612communicate with databases 620, 622, and 624 through a datacommunication network 618. In some embodiments data communicationnetworks 602 and 618 are the same network.

Environment 600 allows resource manager 202 to coordinate user datastorage and retrieval requests across the multiple virtual warehouses608-616 to store and retrieve data in databases 620-624. Virtualwarehouse groups 604 and 606 can be located in the same geographic area,or can be separated geographically. Additionally, virtual warehousegroups 604 and 606 can be implemented by the same entity or by differententities.

The systems and methods described herein allow data to be stored andaccessed as a service that is separate from computing (or processing)resources. Even if no computing resources have been requested from theexecution platform, data is available to a virtual warehouse withoutrequiring reloading of the data from a remote data source. The describedsystems and methods are useful with any type of data. In particularembodiments, data is stored in a structured, optimized format. Thedecoupling of the data storage/access service from the computingservices also simplifies the sharing of data among different users andgroups. As discussed herein, each virtual warehouse can access any datato which it has access permissions, even at the same time as othervirtual warehouses are accessing the same data. This architecturesupports running queries without any actual data stored in the localcache. The systems and methods described herein are capable oftransparent dynamic data movement, which moves data from a remotestorage device to a local cache, as needed, in a manner that istransparent to the user of the system. Further, this architecturesupports data sharing without prior data movement since any virtualwarehouse can access any data due to the decoupling of the data storageservice from the computing service.

FIG. 7 illustrates an implementation of a method for performing a joinprocess over a distributed system wherein a broadcast join has beendetermined to be the optimal join. As can be seen in the figure, method700 may begin with receiving a relational join query comprising apredicate and a plurality of relations at 710.

The method may then call for separating the equijoin operation into abuild operation and a probe operation 720, and will continue bygenerating a build operator for the build operation at 730 and a probeoperator for the probe operations at 740. In the implementation thebuild operator may be responsible for deciding whether to performbroadcasting or re-partitioning join, and the probe operator may performthe actual, local join.

Once the probe operator and build operator has been created, the method700 can address the communication links to the relations by placingcommunication links between a first relation and the probe operator inan adaptive state at 750. In an implementation, the communication linkbetween the first relation (S) and the probe operator, may be initiallyinactive and in the “adaptive” state.

The method may then continue by placing the communication links to asecond relation, in a partition state at 760, wherein the partitionstate facilitates the partition move of the second relation.

Once the communication links are place in the proper state, at 770 themethod causes computing components within the system to repeat the buildoperation until the second relation is fully consumed and forwarded tothe build operators. As mentioned above, the build operators may bestored in local cache so as to reduce traffic over the distributedsystem. After the relation has been consumed by the build operator theexact or actual size of the relation is known. Having actual knowledgeof the relation allows the method to determine the most efficient typeof join to continue with.

In the implementation, at 780 the method determines to join therelations via the broadcasting join based on the actual size of thesecond relation, an estimated size of the first relation, and a costmetric. At 782, the method converts the communication link between thebuild operator and the probe operator into a broadcast link tofacilitate the broadcast join. Then the method sends the correspondingrelation through the broadcast link, which means the local partition ofthe relation of each instance of the build operator is broadcasted toevery instance of the probe operator.

Additionally, at 786 the method converts the communication link betweenthe first relation and the probe operator into a sink link. In thisimplementation, a synchronous link does not perform a network transfer.In other words, the local partition of the relation of each process ormachine is directly forwarded to its local instance of the probeoperator.

At 790, the method causes the computing components of the system toperform the equijoin of the first and second relations, therebyreturning all of the tuples that satisfy the predicate.

FIG. 8 illustrates an implementation of a method for performing a joinprocess over a distributed system wherein a partition join has beendetermined to be the optimal join. As can be seen in the figure, method800 may begin with receiving a relational join query comprising apredicate and a plurality of relations at 810.

The method may then call for separating the equijoin operation into abuild operation and a probe operation 820, and will continue bygenerating a build operator for the build operation at 830 and a probeoperator for the probe operations at 840. In the implementation thebuild operator may be responsible for deciding whether to performbroadcasting or re-partitioning join, and the probe operator may performthe actual, local join.

Once the probe operator and build operator has been created, the method800 can address the communication links to the relations by placingcommunication links between a first relation and the probe operator inan adaptive state at 850. In an implementation, the communication linkbetween the first relation and the probe operator, may be initiallyinactive and in the “adaptive” state.

The method may then continue by placing the communication links to asecond relation, in a partition state at 860, wherein the partitionstate facilitates the partition move of the second relation.

Once the communication links are place in the proper state, at 870 themethod causes computing components within the system to repeat the buildoperation until the second relation is fully consumed and forwarded tothe build operators. As mentioned above, the build operators may bestored in local cache so as to reduce traffic over the distributedsystem. After the relation has been consumed by the build operator theexact or actual size of the relation is known. Having actual knowledgeof the relation allows the method to determine the most efficient typeof join to continue with.

In the implementation, at 880 the method determines to join therelations via the repartitioning join based on the actual size of thesecond relation, an estimated size of the first relation, and a costmetric. At 883, the method converts the communication link between thebuild operator and the probe operator into a broadcast link. Then themethod sends the corresponding relation through the partition link

Additionally, at 885 the method converts the communication link betweenthe first relation and the probe operator into a synchronous link. Inthis implementation, a synchronous link does not perform a networktransfer.

At 887, the relation of each process or machine is directly forwarded toits local instance of the probe operator. Additionally, at 889 themethod broadcasts each instance of the build operator of the secondrelation from the local partition and thereby causes the computingcomponents of the system to perform the repartition equijoin of thefirst and second relations, thereby returning all of the tuples thatsatisfy the predicate.

FIG. 9 illustrates an implementation of a method for performing a joinprocess over a distributed system wherein a partition join has beendetermined to be the optimal join. As can be seen in the figure, method900 may begin with receiving a relational join query comprising apredicate and a plurality of relations at 910.

The method may then call for separating the equijoin operation into abuild operation and a probe operation 920, and will continue bygenerating a build operator for the build operation at 930 and a probeoperator for the probe operations at 940. In the implementation thebuild operator may be responsible for deciding whether to performbroadcasting or re-partitioning join, and the probe operator may performthe actual, local join.

Once the probe operator and build operator has been created, the method900 can address the communication links to the relations by placingcommunication links between a first relation and the probe operator inan adaptive state at 950. In an implementation, the communication linkbetween the first relation and the probe operator, may be initiallyinactive and in the “adaptive” state.

The method may then continue by placing the communication links to asecond relation, in a partition state at 960, wherein the partitionstate facilitates the partition move of the second relation.

Once the communication links are place in the proper state, at 970 themethod causes computing components within the system to repeat the buildoperation until the second relation is fully consumed and forwarded tothe build operators. As mentioned above, the build operators may bestored in local cache so as to reduce traffic over the distributedsystem. After the relation has been consumed by the build operator theexact or actual size of the relation is known. Having actual knowledgeof the relation allows the method to determine the most efficient typeof join to continue with.

In the implementation, at 980 the method determines to join therelations via the repartitioning join based on the actual size of thesecond relation, an estimated size of the first relation, and a costmetric. At 983, the method converts the communication link between thebuild operator and the probe operator into a synchronous link.

Additionally, at 985 the method converts the communication link betweenthe first relation and the probe operator into a partition link.

At 990, the local partition of the relation of each process or machineis directly forwarded to its local instance of the probe operator inorder to perform the repartition equijoin of the first and secondrelations, thereby returning all of the tuples that satisfy thepredicate.

FIG. 10 illustrates an implementation of a method for performing a joinprocess over a distributed system. As can be seen in the figure, method1000 may begin with receiving a relational join query comprising apredicate and a plurality of relations at 1010.

The method may then call for separating the equijoin operation into abuild operation and a probe operation 1020, and will continue bygenerating a build operator for the build operation at 1030 and a probeoperator for the probe operations at 1040. In the implementation thebuild operator may be responsible for deciding whether to performbroadcasting or re-partitioning join, and the probe operator may performthe actual, local join.

Once the probe operator and build operator have been created, the method1000 can address the communication links to the relations by placingcommunication links between a first relation and the probe operator inan adaptive state at 1000. In an implementation, the communication linkbetween the first relation and the probe operator, may be initiallyinactive and in the “adaptive” state.

The method may then continue by converting the communication links tothe second relation from an adaptive state in to a partition state at1060. The method may then select an optimal processing method at 1065from a group comprising the methods: hash join, sort-merge join, andnested-loops in order to accomplish the join optimally.

At 1070 the method causes computing components within the system torepeat the build operation until the second relation is fully consumedand forwarded to the build operators. After the relation has beenconsumed by the build operator the actual size of the relation is known.Having actual knowledge of the relation allows the method to determinethe most efficient type of join to continue with.

In the implementation, at 1080 the method determines to join therelations via the repartitioning join based on the actual size of thesecond relation, an estimated size of the first relation, and a costmetric. At 1085, the method may call for the partitioning of the secondrelation via the communication link between the second relation and thebuild operator in a manner that is compatible with the partition linkbetween the first relation and the probe.

At 1090, the method may send a partition of the second relationcorresponding to a build operator instance as a single pointer to ablock of memory or a file on disk in order to complete the joinoperation.

It should be noted that a second relation may be a base relation, or maybe an output of a sub-expression. Additionally, all of the aboveoperators may buffer to main memory or external storage.

FIG. 11 is a block diagram depicting an example computing device 1100.In some embodiments, computing device 1100 is used to implement one ormore of the systems and components discussed herein. For example,computing device 1100 may allow a user or administrator to accessresource manager 202. Further, computing device 1100 may interact withany of the systems and components described herein. Accordingly,computing device 1100 may be used to perform various procedures andtasks, such as those discussed herein. Computing device 1100 canfunction as a server, a client or any other computing entity. Computingdevice 1100 can be any of a wide variety of computing devices, such as adesktop computer, a notebook computer, a server computer, a handheldcomputer, a tablet, and the like.

Computing device 1100 includes one or more processor(s) 1102, one ormore memory device(s) 1104, one or more interface(s) 1106, one or moremass storage device(s) 1108, and one or more Input/Output (I/O)device(s) 1110, all of which are coupled to a bus 1112. Processor(s)1102 include one or more processors or controllers that executeinstructions stored in memory device(s) 1104 and/or mass storagedevice(s) 1108. Processor(s) 1102 may also include various types ofcomputer-readable media, such as cache memory.

Memory device(s) 1104 include various computer-readable media, such asvolatile memory (e.g., random access memory (RAM)) and/or nonvolatilememory (e.g., read-only memory (ROM)). Memory device(s) 1104 may alsoinclude rewritable ROM, such as Flash memory.

Mass storage device(s) 1108 include various computer readable media,such as magnetic tapes, magnetic disks, optical disks, solid statememory (e.g., Flash memory), and so forth. Various drives may also beincluded in mass storage device(s) 1108 to enable reading from and/orwriting to the various computer readable media. Mass storage device(s)1108 include removable media and/or non-removable media.

I/O device(s) 1110 include various devices that allow data and/or otherinformation to be input to or retrieved from computing device 1100.Example I/O device(s) 1110 include cursor control devices, keyboards,keypads, microphones, monitors or other display devices, speakers,printers, network interface cards, modems, lenses, CCDs or other imagecapture devices, and the like.

Interface(s) 1106 include various interfaces that allow computing device1100 to interact with other systems, devices, or computing environments.Example interface(s) 1106 include any number of different networkinterfaces, such as interfaces to local area networks (LANs), wide areanetworks (WANs), wireless networks, and the Internet.

Bus 1112 allows processor(s) 1102, memory device(s) 1104, interface(s)1106, mass storage device(s) 1108, and I/O device(s) 1110 to communicatewith one another, as well as other devices or components coupled to bus1112. Bus 1112 represents one or more of several types of busstructures, such as a system bus, PCI bus, IEEE 1394 bus, USB bus, andso forth.

For purposes of illustration, programs and other executable programcomponents are shown herein as discrete blocks, although it isunderstood that such programs and components may reside at various timesin different storage components of computing device 1100, and areexecuted by processor(s) 1102. Alternatively, the systems and proceduresdescribed herein can be implemented in hardware, or a combination ofhardware, software, and/or firmware. For example, one or moreapplication specific integrated circuits (ASICs) can be programmed tocarry out one or more of the systems and procedures described herein.Additionally, as used herein, a “module” is intended to mean anycombination of software, computer hardware, and firmware that operatesaccording to computer readable instructions to perform processing tasks.It should also be noted that in some implementations, a module may onlybe software, or only computer hardware, or only firmware. Although thepresent disclosure is described in terms of certain preferredembodiments, other embodiments will be apparent to those of ordinaryskill in the art, given the benefit of this disclosure, includingembodiments that do not provide all of the benefits and features setforth herein, which are also within the scope of this disclosure. It isto be understood that other embodiments may be utilized, withoutdeparting from the scope of the present disclosure.

1. A method for performing an implementation of a join operation,comprising: receiving a relational join query comprising a joincondition and an indication of a first relation and a second relation tobe joined, wherein the join query is for an equality join operation andthe first relation and the second relation are partitioned overprocessing nodes of a parallel processing architecture; building a hashindex of the second relation; determining an actual size of the secondrelation; and determining whether to distribute the first and secondrelations by duplicating the second relation across the processing nodesof the parallel processing architecture, or by redistributing the firstand second relations across one or more processing nodes of the parallelprocessing architecture, wherein the determining is based at least inpart on the actual size of the second relation and a cost metric,wherein the determining whether to distribute the first and secondrelations step takes place during execution of the join query and afterthe size of the second relation has been determined.
 2. The method ofclaim 1 wherein the cost metric is a memory cost.
 3. The method of claim1 wherein the cost metric is a computational cost.
 4. The method ofclaim 1, wherein during a duplication of the second relation, a localpartition of the first relation is forwarded to a local instance of aprobe operator for performing the relational join query.
 5. The methodof claim 4, wherein duplicating the second relation comprisesbroadcasting each partition of the second relation to every instance ofthe probe operator across the processing nodes of the parallelprocessing architecture.
 6. The method of claim 1, whereinredistributing the first and second relations comprises partitioning thefirst relation across the processing nodes of the parallel processingarchitecture, and the redistributing is performed by each of theprocessing nodes of the parallel processing architecture.
 7. The methodof claim 6, wherein the partitioning operation on the first relation iscompatible with a partitioning function previously applied to the secondrelation such that each pair of tuples that satisfy the join conditionis placed in the same partition and within the same instance of theprobe operation in the parallel processing architecture.
 8. The methodof claim 7, wherein the partitioning function previously applied to thesecond relation is performed during or before the building of the hashindex, and wherein the partitions of the second relation are not readback at the time of partitioning the first relation.
 9. The method ofclaim 1, further comprising partitioning the second relation and, duringa redistribution of the first and second relations, sending a partitionof the second relation to a local probe operator instance as a pointerto a block of memory or a file on disk.
 10. The method of claim 1,wherein the determining the actual size of the second relation is basedon the building of the hash index.
 11. A system comprising: a memory tostore a plurality of relations; and a processor configured to: receive arelational join query comprising a join condition and an indication of afirst relation and a second relation to be joined, wherein the joinquery is for an equality join operation and the first relation and thesecond relation are partitioned over processing nodes of a parallelprocessing architecture; build a hash index of the second relationdetermine an actual size of the second relation based on the building ofthe hash index; and determine whether to distribute the first and secondrelations by duplicating the second relation across the processing nodesof the parallel processing architecture, or by redistributing the firstand second relations across one or more processing nodes of the parallelprocessing architecture, wherein the determining is based at least inpart on the actual size of the second relation, wherein the processor isconfigured to determine whether to distribute the first and secondrelations step takes place during execution of the join query and afterthe size of the second relation has been determined.
 12. The system ofclaim 11 wherein the cost metric is a memory cost.
 13. The system ofclaim 11 wherein the cost metric is a computational cost.
 14. The systemof claim 11, wherein during a duplication of the second relation, theprocessor is configured to forward a local partition of the firstrelation to a local instance of a probe operator for performing therelational join query.
 15. The system of claim 14, wherein to duplicatethe second relation, the processor is further to broadcast eachpartition of the second relation to a plurality of instances of theprobe operator across the processing nodes of the parallel processingarchitecture.
 16. The system of claim 11, wherein to redistribute thefirst and second relations, the processor is configured to partition thefirst relation across the processing nodes of the parallel processingarchitecture and the redistributing is performed by each of theprocessing nodes of the parallel processing architecture.
 17. The systemof claim 16, wherein the partitioning operation on the first relation iscompatible with a partitioning function previously applied to the secondrelation such that each pair of tuples that satisfy the join conditionis placed in the same partition and within the same instance of theprobe operation in the parallel processing architecture.
 18. The systemof claim 17, wherein the processor is configured to perform thepartitioning function previously applied to the second relation duringor before the building of the hash index, and wherein the partitions ofthe second relation are not read back at the time of partitioning thefirst.
 19. The system of claim 18, wherein the processor is furtherconfigured to partition the second relation and, during a redistributionof the first and second relations, send a partition of the secondrelation to a local probe operator instance as a single pointer to ablock of memory or a file on disk.
 20. The system of claim 11, whereinthe processor is configured to determine the actual size of the secondrelation based on the building of the hash index.
 21. A non-transitorycomputer readable medium having instructions stored thereon that, whenexecuted by a processor, cause the processor to: receive a relationaljoin query comprising a join condition and an indication of a firstrelation and a second relation to be joined, wherein the join query isfor an equality join operation and the first relation and the secondrelation are partitioned over processing nodes of a parallel processingarchitecture; build a hash index of the second relation determine anactual size of the second relation; and determine whether to distributethe first and second relations by duplicating the second relation acrossthe processing nodes of the parallel processing architecture, or byredistributing the first and second relations across one or moreprocessing nodes of the parallel processing architecture, wherein thedetermining is based at least in part on the actual size of the secondrelation, wherein the instructions, when executed by the processor,cause the processor to determine whether to distribute the first andsecond relations during execution of the join query and after the sizeof the second relation has been determined.
 22. The non-transitorycomputer readable medium of claim 21, wherein the cost metric is amemory cost.
 23. The non-transitory computer readable medium of claim21, wherein the cost metric is a computational cost.
 24. Thenon-transitory computer readable medium of claim 15, wherein during aduplication of the second relation, the instructions, when executed bythe processor, cause the processor to forward a local partition of thefirst relation to a local instance of a probe operator for performingthe relational join query.
 25. The non-transitory computer readablemedium of claim 24, wherein to duplicate the second relation, theinstructions, when executed by the processor, cause the processor to tobroadcast each partition of the second relation to a plurality ofinstances of the probe operator across the processing nodes of theparallel processing architecture.
 26. The non-transitory computerreadable medium of claim 21, wherein to redistribute the first andsecond relations, instructions, when executed by the processor, causethe processor to partition the first relation across the processingnodes of the parallel processing architecture and the redistributing isperformed by each of the processing nodes of the parallel processingarchitecture.
 27. The non-transitory computer readable medium of claim26, wherein the partitioning operation on the first relation iscompatible with a partitioning function previously applied to the secondrelation such that each pair of tuples that satisfy the join conditionis placed in the same partition and within the same instance of theprobe operation in the parallel processing architecture.
 28. Thenon-transitory computer readable medium of claim 27, wherein theinstructions, when executed by the processor, cause the processor toperform the partitioning function previously applied to the secondrelation during or before the building of the hash index, and whereinthe partitions of the second relation are not read back at the time ofpartitioning the first relation.